package com.chinasofti.project.web.form;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.chinasofti.project.common.web.BaseForm;
import com.chinasofti.project.exceptions.ValidationException;

public class RegisterForm extends BaseForm {
	
    @NotBlank(message="密码不能为空")
    @Length(min=6,max=16,message="密码的长度应该在{min}与{max}之间")
    private String userPassword;//用户密码
    
    @NotBlank(message="确认密码不能为空")//确认用户的密码
    private String rePassword;
    
    @NotBlank(message="邮箱不能为空")
    @Email(message="邮箱格式不正确")
    private String userEmail;//用户邮箱

    @NotBlank(message="验证码不能为空")
    private String userCaptcha;
    
    @Override
    protected void validateMore() {
    	if(!userPassword.equals(rePassword)){
    		throw new ValidationException("userPassword","两次输入的密码不相同");
    	}
    }

	public String getUserPassword() {
		return userPassword;
	}

	public void setUserPassword(String userPassword) {
		this.userPassword = userPassword;
	}

	public String getRePassword() {
		return rePassword;
	}

	public void setRePassword(String rePassword) {
		this.rePassword = rePassword;
	}

	public String getUserEmail() {
		return userEmail;
	}

	public void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}

	public String getUserCaptcha() {
		return userCaptcha;
	}

	public void setUserCaptcha(String userCaptcha) {
		this.userCaptcha = userCaptcha;
	}

	
}
